<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>审核状态： <select id="checkState" name="checkState">
									<option label="所有" value="" />
									<option label="未审核" value="0" />
									<option label="审核通过" value="1" />
									<option label="审核未通过" value="2" />
							</select> <a></a>
							</li>

							<li>出库时间：<select id="time" name="time">
									<option label="所有" value="" />
									<option label="今日" value="1" />
									<option label="昨日" value="2" />
									<option label="近七天" value="3" />
									<option label="近一个月" value="4" />
							</select>
							</li>

							<li>关键字：<input type="text" name="key" />
							</li>

							<li><a class="btn btn-primary btn-rounded btn-sm"
								onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm"
								onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>

			<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
				<!-- 	<a class="btn btn-success" onclick="$.operate.add()"
					shiro:hasPermission="gxgw_modules:output:add"> <i
					class="fa fa-plus"></i> 添加
				</a> <a class="btn btn-primary btn-edit disabled"
					onclick="$.operate.edit()"
					shiro:hasPermission="gxgw_modules:output:edit"> <i
					class="fa fa-edit"></i> 修改
				</a> -->
				<a class="btn btn-danger btn-del btn-del disabled"
					onclick="$.operate.removeAll()"
					shiro:hasPermission="gxgw_modules:output:remove"> <i
					class="fa fa-remove"></i> 删除
				</a> <a class="btn btn-warning" onclick="$.table.exportExcel()"
					shiro:hasPermission="gxgw_modules:output:export"> <i
					class="fa fa-download"></i> 导出
				</a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
	<div th:include="include :: footer"></div>
	<script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('gxgw_modules:output:edit')}]];
        var removeFlag = [[${@permission.hasPermi('gxgw_modules:output:remove')}]];
        var prefix = ctx + "gxgw_modules/output";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "商品出库",
				search: false,
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'outputId', 
					title : '序号',
					visible: false
				},
				{
					field : 'goodsName', 
					title : '商品名称',
					sortable: true
				},
				{
					field : 'goodsBar', 
					title : '商品条码',
					sortable: true
				},
				{
					field : 'outputNum', 
					title : '出库数量',
					sortable: true
				},
				{
					field : 'outputTime', 
					title : '出库时间',
					sortable: true
				},
				{
					field : 'adminId', 
					title : '操作员',
					sortable: true
				},
				{
					field : 'checkName', 
					title : '审核人',
					sortable: true
				},
				{
					field : 'checkTime', 
					title : '审核时间',
					sortable: true
				},
				{
					field : 'checkState', 
					title : '审核状态',
					sortable: true,
					formatter: function (value) {
						switch (value) {
							case 0:
								return '未审核'
							case 1:
								return '审核通过'
							case 2:
								return '审核不通过'
							
						}
					}
				},
				{
					field : 'remark', 
					title : '备注',
					sortable: true
				},
				
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.outputId + '\')"><i class="fa fa-edit"></i>审核</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.outputId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
            $('select#checkState').change(function(){
            	$.table.search();
                });
            $('select#time').change(function(){
            	$.table.search();
                });
        });
    </script>
</body>
</html>